#include <string.h>
#include <fstream>
#include <iostream>
using std::cout;
using std::endl;
using std::ofstream;
using std::string;

void test0(){
    string filename = "test1.txt";
    //app模式是能够确保每次寻位到流结尾位置
    ofstream ofs(filename,std::ios::app);

    string line("hello,world\n");
    //通过输出流运算符进行输出（写入文件）
    ofs << line;

    char buff[100] = "wangdao!\n";
    //通过write函数进行输出（写入文件）
    ofs.write(buff,strlen(buff));

    ofs.close();
}

int main(void){
    test0();
    return 0;
}


